package com.steven.controller;

import com.steven.domain.User;
import com.steven.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 12-6-9
 * Time: 下午2:24
 * To change this template use File | Settings | File Templates.
 */
@Controller
public class Demo {

    @Autowired
    @Qualifier("userService")
    private UserService userService;

    @RequestMapping(value ="/index" )
    @ResponseBody
    public  String index(){

        List user_list = userService.queryAll(" from User");

        User user = (User) user_list.get(0);

        return user.getUsername();
    }
}
